package com.kun.portal.webframe.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2018-07-16.
 * 资质证书管理
 *
 */
@Entity
@Table(
        name = "certificate_mgr"
)
@DynamicUpdate
public class CertificateMgrPo implements Serializable {

    @Id
    @GeneratedValue(
            generator = "certificate_mgr_id"
    )

    @GenericGenerator(
            name = "certificate_mgr_id",
            strategy = "uuid"
    )
    @Column(
            name = "certificate_mgr_id",
            length = 32,
            nullable = false
    )
    private String certificateMgrId;//id

    @Column(
            name = "id_number",
            length = 100
    )
    private String idNumber;//身份证号
    @Column(
            name = "certificate",
            length = 100
    )
    private String certificate;//资质证书
    @Column(
            name = "certificate_auth",
            length = 100
    )
    private String certificateAuth;//发证机关
    @Column(
            name = "certificate_date",
            length = 100
    )
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    private Date certificateDate;//发证日期
    @Column(
            name = "certificate_num",
            length = 100
    )
    private String certificateNum;//发证编号
    @Column(
            name = "certificate_indate",
            length = 100
    )
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    private Date certificateIndate;//证件有效期至
    @Column(
            name = "remarks",
            length = 100
    )
    private String remarks;//备注
    @OneToMany(cascade={ CascadeType.REMOVE },fetch=FetchType.EAGER,mappedBy = "certificateMgrPo" )
    private List<CertificateFilePo> certificateFilePos;//资质证书文件
    @OneToOne(targetEntity = FwUserPo.class)
    @JoinColumn(name = "user_id",referencedColumnName = "user_id")
    private FwUserPo fwUserPo;//用户

    public FwUserPo getFwUserPo() {
        return fwUserPo;
    }

    public void setFwUserPo(FwUserPo fwUserPo) {
        this.fwUserPo = fwUserPo;
    }

    public List<CertificateFilePo> getCertificateFilePos() {
        return certificateFilePos;
    }

    public void setCertificateFilePos(List<CertificateFilePo> certificateFilePos) {
        this.certificateFilePos = certificateFilePos;
    }

    public String getCertificateMgrId() {
        return certificateMgrId;
    }

    public void setCertificateMgrId(String certificateMgrId) {
        this.certificateMgrId = certificateMgrId;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public String getCertificate() {
        return certificate;
    }

    public void setCertificate(String certificate) {
        this.certificate = certificate;
    }

    public String getCertificateAuth() {
        return certificateAuth;
    }

    public void setCertificateAuth(String certificateAuth) {
        this.certificateAuth = certificateAuth;
    }

    public Date getCertificateDate() {
        return certificateDate;
    }

    public void setCertificateDate(Date certificateDate) {
        this.certificateDate = certificateDate;
    }

    public String getCertificateNum() {
        return certificateNum;
    }

    public void setCertificateNum(String certificateNum) {
        this.certificateNum = certificateNum;
    }

    public Date getCertificateIndate() {
        return certificateIndate;
    }

    public void setCertificateIndate(Date certificateIndate) {
        this.certificateIndate = certificateIndate;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
}
